#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N = 5e6 + 10;
struct S
{
	int s, c, d;
}s[N];
int n, m;
int cmp(S a, S b)
{
	if (a.s != b.s) {
		return a.s < b.s;
	}
	if (a.c != b.c) {
		return a.c < b.c;
	}
	return a.d < b.d;
}
int main()
{
	cin >> n;
	for (int c = 0; c * c <= n; c++) {
		for (int d = c; d * d + c * c <= n; d++) {
			s[m++] = { c * c + d * d,c,d };
		}
	}
	sort(s, s + m, cmp);
	for (int a = 0; a * a <= n; a++) {
		for (int b = a; b * b + a * a <= n; b++) {
			int t = n - a * a - b * b;
			int l = 0, r = m;
			while (l < r) {
				int mid = l + r >> 1;
				if (s[mid].s >= t) {
					r = mid;
				}
				else {
					l = mid + 1;
				}
			}
			if (s[l].s == t) {
				cout << a << " " << b << " " << s[l].c << " " << s[l].d << endl;
				return 0;
			}
		}
	}
	return 0;
}
//int main()
//{
//	cin >> n;
//	for (int a = 0; a * a <= n; a++) {
//		for (int b = a; b * b + a * a <= n; b++) {
//			for (int c = b; c * c + b * b + a * a <= n; c++) {
//				int d = n - a * a - b * b - c * c;
//				int t = sqrt(d);
//				if (t * t == d) {
//					cout << a << " " << b << " " << c << " " << t << endl;
//					return 0;
//				}
//			}
//		}
//	}
//	return 0;
//}